import { Scene, Canvas, Leafer } from "leafer-ui";

export class Scene {
  constructor(options) {
    const { camera } = options;
    this._core = new Leafer();
    const canvas = new Canvas({
      x: options.x,
      y: options.y,
      width: options.width,
      height: options.height,
      pixelRatio: options.pixelRatio,
    });
    this._core.add(canvas);
    this._canvas = canvas;
    this._camera = camera;
  }

  run() {
    this._canvas.context.clearRect(
      0,
      0,
      this._canvas.width,
      this._canvas.height
    );
    this._canvas.setTransform(
      this._canvas.pixelRatio,
      0,
      0,
      this._canvas.pixelRatio,
      0,
      0
    );
    this._canvas.paint();
  }

  getCore() {
    return this._core;
  }
}
